<!DOCTYPE html>
<html lang="zh" dir="auto">

<head><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="index, follow">
<title>建造枪工具 | Build Gun Utilities | 幸福工厂模组</title>
<meta name="keywords" content="">
<meta name="description" content="模组：建造枪工具 —— Build Gun Utilities 已支持 U8 和多人游戏。提供建造枪的改进功能如下： 显示传送带的长度和角度； 显示垂直传送带和孔的高度； 显示管道的长度和角">
<meta name="author" content="VisualMOD">
<link rel="canonical" href="https://visualmod.gitee.io/satisfactory-mod/mods/build_gun_utilities/">
<link crossorigin="anonymous" href="/satisfactory-mod/assets/css/stylesheet.fda8facc5b630094d5b2968a3585893846cba1d07e967f92a271b6a941eb2d90.css" integrity="sha256-/aj6zFtjAJTVspaKNYWJOEbLodB&#43;ln&#43;SonG2qUHrLZA=" rel="preload stylesheet" as="style">
<script defer crossorigin="anonymous" src="/satisfactory-mod/assets/js/highlight.f413e19d0714851f6474e7ee9632408e58ac146fbdbe62747134bea2fa3415e0.js" integrity="sha256-9BPhnQcUhR9kdOfuljJAjlisFG&#43;9vmJ0cTS&#43;ovo0FeA="
    onload="hljs.initHighlightingOnLoad();"></script>
<link rel="icon" href="https://visualmod.gitee.io/satisfactory-mod/favicon.ico">
<link rel="icon" type="image/png" sizes="16x16" href="https://visualmod.gitee.io/satisfactory-mod/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://visualmod.gitee.io/satisfactory-mod/favicon-32x32.png">
<link rel="apple-touch-icon" href="https://visualmod.gitee.io/satisfactory-mod/apple-touch-icon.png">
<link rel="mask-icon" href="https://visualmod.gitee.io/satisfactory-mod/safari-pinned-tab.svg">
<meta name="theme-color" content="#2e2e33">
<meta name="msapplication-TileColor" content="#2e2e33">
<link rel="alternate" hreflang="zh" href="https://visualmod.gitee.io/satisfactory-mod/mods/build_gun_utilities/">
<noscript>
    <style>
        #theme-toggle,
        .top-link {
            display: none;
        }

    </style>
    <style>
        @media (prefers-color-scheme: dark) {
            :root {
                --theme: rgb(29, 30, 32);
                --entry: rgb(46, 46, 51);
                --primary: rgb(218, 218, 219);
                --secondary: rgb(155, 156, 157);
                --tertiary: rgb(65, 66, 68);
                --content: rgb(196, 196, 197);
                --hljs-bg: rgb(46, 46, 51);
                --code-bg: rgb(55, 56, 62);
                --border: rgb(51, 51, 51);
            }

            .list {
                background: var(--theme);
            }

            .list:not(.dark)::-webkit-scrollbar-track {
                background: 0 0;
            }

            .list:not(.dark)::-webkit-scrollbar-thumb {
                border-color: var(--theme);
            }
        }

    </style>
</noscript><meta property="og:title" content="建造枪工具 | Build Gun Utilities" />
<meta property="og:description" content="模组：建造枪工具 —— Build Gun Utilities 已支持 U8 和多人游戏。提供建造枪的改进功能如下： 显示传送带的长度和角度； 显示垂直传送带和孔的高度； 显示管道的长度和角" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://visualmod.gitee.io/satisfactory-mod/mods/build_gun_utilities/" /><meta property="article:section" content="mods" />
<meta property="article:published_time" content="2023-07-10T16:00:00+08:00" />
<meta property="article:modified_time" content="2023-07-10T16:00:00+08:00" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="建造枪工具 | Build Gun Utilities"/>
<meta name="twitter:description" content="模组：建造枪工具 —— Build Gun Utilities 已支持 U8 和多人游戏。提供建造枪的改进功能如下： 显示传送带的长度和角度； 显示垂直传送带和孔的高度； 显示管道的长度和角"/>


<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [, 
    {
      "@type": "ListItem",
      "position":  2 ,
      "name": "Mods",
      "item": "https://visualmod.gitee.io/satisfactory-mod/mods/"
    }, 
    {
      "@type": "ListItem",
      "position":  3 ,
      "name": "建造枪工具 | Build Gun Utilities",
      "item": "https://visualmod.gitee.io/satisfactory-mod/mods/build_gun_utilities/"
    }
  ]
}
</script>
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "headline": "建造枪工具 | Build Gun Utilities",
  "name": "建造枪工具 | Build Gun Utilities",
  "description": "模组：建造枪工具 —— Build Gun Utilities 已支持 U8 和多人游戏。提供建造枪的改进功能如下： 显示传送带的长度和角度； 显示垂直传送带和孔的高度； 显示管道的长度和角",
  "keywords": [
    
  ],
  "articleBody": "模组：建造枪工具 —— Build Gun Utilities\n已支持 U8 和多人游戏。提供建造枪的改进功能如下：\n显示传送带的长度和角度； 显示垂直传送带和孔的高度； 显示管道的长度和角度； 显示柱子（梁）的高度； 相对于起始坐标，显示建造预览图的相对位置； （可选）建造模式中显示预览的绝对坐标； （可选）拆除模式中显示建筑的绝对坐标； （可选）拆除模式可拆除地形元素； 批量拆除：Ctrl+Delete 调整拆除半径，Shift+Delete 标记球形范围内的带拆除物体。使用此功能时会返还建筑材料； （可选）更改建造枪的使用范围和延迟； （测试）移动可建造物，建造模式下按住左 Shift 可调整位置（默认禁用，需要手动更改配置文件来启用）。 用户手册：Docs for SifMods\n仅在使用建造枪时上述功能才会启用。未来，许多功能可能会加入原版游戏中。\n已知问题：\n移动可建造物的功能有时会发生错误 管道和传送带支架的高度显示可能有问题 点击展开英文说明 Mod is U8 ready Docs for SifMods - Mod User Manuals\nEver wondered how high you have dragged the lift top out while building? Been annoyed that your stackable poles became too tall because you couldn’t see how high you made it? Well, now you can see this if you install this mod.\nCurrently does this to the Build Gun when in use:\nShows the length and angle of conveyor belts Shows the height of conveyor poles and lifts Shows the length and angle of pipelines Shows the height of pillars Shows the relative position of projected holograms depending on spawn coordinates Shows the absolute position of holograms (optional) Shows the absolute position of existing buildings when in dismantle mode (optional) Can destroy terrain elements in dismantle mode (optional) Mass Dismantle - Use Delete to see area of effect, Ctrl-Delete to change diameter and Shift-Delete to mark things within the sphere. Dismantle as usual. The feature does give back the materials used for construction. Can set Build Gun Range and Delay (optional) Experimental feature: Move Buildable (must be enabled in mod config, default off) Little documentation exists for Move Buildable but currently you hold left shift down while dragging the building around using the mouse. You can rotate the building using A/D and Raise/Lower it using W/S, while holding shift. This feature is due for a rewrite for the Enhanced Input system of Unreal Engine 5. I’ll try to make Move Buildable less wonky then too.\nTip: For ‘Relative Position’ to work as a good measuring stick when building such as pillars/beams to build a flat, for example, Hypertube, use the pillar/beam hotbar to spawn a hologram on top of the other pillar/beam you want the new one to align with as the top of the pillar/beam will be 0, 0, 0. I used this method when building my latest Hypertube and it worked pretty well. It then becomes like a laser level with an LCD showing off-sets.\nThe feature is only active for as long as the Build Gun is active. Light-weight script accessing data from the base game.\nI consider these features something which should be part of the base game, but here you go instead via a mod.\nMore features are coming.\nScreenshots and Videos presentation below:\nConveyor Lift Height Your browser does not support the video tag. Conveyor Belt Length Your browser does not support the video tag. Conveyor Pole Height Your browser does not support the video tag. Pillar Length Your browser does not support the video tag. Mass Dismantle Your browser does not support the video tag. Conveyor Lift Height (older version without head angle) Conveyor Lift Height (older version with head angle) Pipe Length (older version) Conveyor Belt Length \u0026 Relative Pos #1 (older version without angle) Conveyor Belt Length \u0026 Relative Pos #2 (older version without angle) Conveyor Belt Length \u0026 Relative Pos #3 (older version without angle) Known issues:\nThe Move Buildable feature does work far from perfectly Pipe and conveyor pole supports’ height display improperly A mod by SifVerT - Difficulty Tuner \u0026 Factory Statistics If you have any feedback you can find me on Discord as SifVerT. I’m only on my own support server for support matters, should you require any help:\nTotally voluntary, but if you appreciate my work you may leave a little tip.\nIcon by Ruler icons created by srip - Flaticon 返回模组列表 在 ficsit.app 中查看 ",
  "wordCount" : "955",
  "inLanguage": "zh",
  "datePublished": "2023-07-10T16:00:00+08:00",
  "dateModified": "2023-07-10T16:00:00+08:00",
  "author":{
    "@type": "Person",
    "name": "VisualMOD"
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://visualmod.gitee.io/satisfactory-mod/mods/build_gun_utilities/"
  },
  "publisher": {
    "@type": "Organization",
    "name": "幸福工厂模组",
    "logo": {
      "@type": "ImageObject",
      "url": "https://visualmod.gitee.io/satisfactory-mod/favicon.ico"
    }
  }
}
</script>
</head>

<body class="" id="top">
<script>
    if (localStorage.getItem("pref-theme") === "dark") {
        document.body.classList.add('dark');
    } else if (localStorage.getItem("pref-theme") === "light") {
        document.body.classList.remove('dark')
    } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
        document.body.classList.add('dark');
    }

</script>

<header class="header">
    <nav class="nav">
        <div class="logo">
            <a href="https://visualmod.gitee.io/satisfactory-mod" accesskey="h" title="幸福工厂模组 (Alt + H)">幸福工厂模组</a>
            <div class="logo-switches">
                <button id="theme-toggle" accesskey="t" title="(Alt + T)">
                    <svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
                        fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                        stroke-linejoin="round">
                        <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
                    </svg>
                    <svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
                        fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                        stroke-linejoin="round">
                        <circle cx="12" cy="12" r="5"></circle>
                        <line x1="12" y1="1" x2="12" y2="3"></line>
                        <line x1="12" y1="21" x2="12" y2="23"></line>
                        <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
                        <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
                        <line x1="1" y1="12" x2="3" y2="12"></line>
                        <line x1="21" y1="12" x2="23" y2="12"></line>
                        <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
                        <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
                    </svg>
                </button>
                <ul class="lang-switch"><li>|</li>
                    <li>
                        <a href="https://visualmod.gitee.io/satisfactory-mod/en/" title="English"
                            aria-label="English">English</a>
                    </li>
                </ul>
            </div>
        </div>
        <ul id="menu">
            <li>
                <a href="https://visualmod.gitee.io/satisfactory-mod/manager" title="模组管理器">
                    <span>模组管理器<small>&nbsp;SMM</small></span>
                </a>
            </li>
            <li>
                <a href="https://visualmod.gitee.io/satisfactory-mod/loader" title="模组加载器">
                    <span>模组加载器<small>&nbsp;SML</small></span>
                </a>
            </li>
            <li>
                <a href="https://visualmod.gitee.io/satisfactory-mod/home/modlist" title="⚙ 模组列表">
                    <span>⚙ 模组列表</span>
                </a>
            </li>
            <li>
                <a href="https://visualmod.gitee.io/satisfactory-mod/search" title="🔍搜索 (Alt &#43; /)" accesskey=/>
                    <span>🔍搜索</span>
                </a>
            </li>
        </ul>
    </nav>
</header>
<main class="main">

<article class="post-single">
  <header class="post-header">
    <div class="breadcrumbs"><a href="https://visualmod.gitee.io/satisfactory-mod">主页</a>&nbsp;»&nbsp;<a href="https://visualmod.gitee.io/satisfactory-mod/mods/">Mods</a></div>
    <h1 class="post-title entry-hint-parent">
      建造枪工具 | Build Gun Utilities
    </h1>
    <div class="post-meta"><span title='2023-07-10 16:00:00 +0800 CST'>七月 10, 2023</span>&nbsp;·&nbsp;VisualMOD

</div>
  </header> 
  <div class="post-content"><p>模组：建造枪工具 —— Build Gun Utilities</p>
<p>已支持 U8 和多人游戏。提供建造枪的改进功能如下：</p>
<ul>
<li>显示传送带的长度和角度；</li>
<li>显示垂直传送带和孔的高度；</li>
<li>显示管道的长度和角度；</li>
<li>显示柱子（梁）的高度；</li>
<li>相对于起始坐标，显示建造预览图的<a href="https://github.com/SifVerT/SifDocs/blob/main/Pages/BuildGunUtilities.adoc#relative-position-relative-pos">相对位置</a>；</li>
<li>（可选）建造模式中显示预览的绝对坐标；</li>
<li>（可选）拆除模式中显示建筑的绝对坐标；</li>
<li>（可选）拆除模式可<a href="https://github.com/SifVerT/SifDocs/blob/main/Pages/BuildGunUtilities.adoc#remove-terrain-assets">拆除地形元素</a>；</li>
<li><a href="https://github.com/SifVerT/SifDocs/blob/main/Pages/BuildGunUtilities.adoc#mass-dismantle">批量拆除</a>：<code>Ctrl+Delete</code> 调整拆除半径，<code>Shift+Delete</code> 标记球形范围内的带拆除物体。使用此功能时会返还建筑材料；</li>
<li>（可选）更改建造枪的使用范围和延迟；</li>
<li>（测试）移动可建造物，建造模式下按住左 <code>Shift</code> 可调整位置（默认禁用，需要手动更改配置文件来启用）。</li>
</ul>
<p><a href="https://github.com/SifVerT/SifDocs/blob/main/index.adoc">用户手册：Docs for SifMods</a></p>
<p>仅在使用建造枪时上述功能才会启用。未来，许多功能可能会加入原版游戏中。</p>
<p>已知问题：</p>
<ul>
<li>移动可建造物的功能有时会发生错误</li>
<li>管道和传送带支架的高度显示可能有问题</li>
</ul>

<details>
    <summary><strong>点击展开英文说明</strong></summary>
<table style="width:100%"><tr><td style="border:2px solid #ccc;padding:20px" align="center">Mod is U8 ready</tr></td></table>
<br>
<table><tr>
<td>
<img src="https://raw.githubusercontent.com/deantendo/community/master/com_mp_yes.png">
</td><td>
<img src="https://raw.githubusercontent.com/deantendo/community/master/ea_yes_exp_yes.png">
</td>
</tr>
<tr>
</tr>
</table>

<p><a href="https://github.com/SifVerT/SifDocs/blob/main/index.adoc">Docs for SifMods</a> - Mod User Manuals</p>
<p>Ever wondered how high you have dragged the lift top out while building? Been annoyed that your stackable poles became too tall because you couldn&rsquo;t  see how high you made it? Well, now you can see this if you install this mod.</p>
<p>Currently does this to the Build Gun when in use:</p>
<ul>
<li>Shows the length and angle of conveyor belts</li>
<li>Shows the height of conveyor poles and lifts</li>
<li>Shows the length and angle of pipelines</li>
<li>Shows the height of pillars</li>
<li>Shows the <a href="https://github.com/SifVerT/SifDocs/blob/main/Pages/BuildGunUtilities.adoc#relative-position-relative-pos">relative position</a> of projected holograms depending on spawn coordinates</li>
<li>Shows the absolute position of holograms (optional)</li>
<li>Shows the absolute position of existing buildings when in dismantle mode (optional)</li>
<li>Can <a href="https://github.com/SifVerT/SifDocs/blob/main/Pages/BuildGunUtilities.adoc#remove-terrain-assets">destroy terrain elements</a> in dismantle mode (optional)</li>
<li><a href="https://github.com/SifVerT/SifDocs/blob/main/Pages/BuildGunUtilities.adoc#mass-dismantle">Mass Dismantle</a> - Use Delete to see area of effect, Ctrl-Delete to change diameter and Shift-Delete to mark things within the sphere. Dismantle as usual. The feature does give back the materials used for construction.</li>
<li>Can set Build Gun Range and Delay (optional)</li>
<li>Experimental feature: Move Buildable (must be enabled in mod config, default off)</li>
</ul>
<p>Little documentation exists for Move Buildable but currently you hold left shift down while dragging the building around using the mouse. You can rotate the building using A/D and Raise/Lower it using W/S, while holding shift. This feature is due for a rewrite for the Enhanced Input system of Unreal Engine 5. I&rsquo;ll try to make Move Buildable less wonky then too.</p>
<p>Tip: For &lsquo;Relative Position&rsquo; to work as a good measuring stick when building such as pillars/beams to build a flat, for example, Hypertube, use the pillar/beam hotbar to spawn a hologram on top of the other pillar/beam you want the new one to align with as the top of the pillar/beam will be 0, 0, 0. I used this method when building my latest Hypertube and it worked pretty well. It then becomes like a laser level with an LCD showing off-sets.</p>
<p>The feature is only active for as long as the Build Gun is active. Light-weight script accessing data from the base game.</p>
<p>I consider these features something which should be part of the base game, but here you go instead via a mod.</p>
<p>More features are coming.</p>
<p>Screenshots and Videos presentation below:</p>


<div style="width: 1920px; margin: auto">
<b>Conveyor Lift Height</b>
<video width="1920" height="1080" controls>
  <source src="https://cdn.discordapp.com/attachments/623891487683510323/1040591487605424158/output4.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br>
<b>Conveyor Belt Length</b>
<video width="1920" height="1080" controls>
  <source src="https://cdn.discordapp.com/attachments/623891487683510323/1040591567729209394/output3.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br>
<b>Conveyor Pole Height</b>
<video width="1920" height="1080" controls>
  <source src="https://cdn.discordapp.com/attachments/623891487683510323/1040591656862363688/output2.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br>
<b>Pillar Length</b>
<video width="1920" height="1080" controls>
  <source src="https://cdn.discordapp.com/attachments/623891487683510323/1040591719210696724/output1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br>
<b>Mass Dismantle</b>
<video width="1920" height="1080" controls>
  <source src="https://cdn.discordapp.com/attachments/968785807630557297/1064520783126339615/Satisfactory_2023.01.16_-_13.22.06.02.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br><br>
<b>Conveyor Lift Height (older version without head angle)</b>
<img src="https://media.discordapp.net/attachments/623891487683510323/1040407969726201886/image.png">
<br><br>
<b>Conveyor Lift Height (older version with head angle)</b>
<br>
<img src="https://media.discordapp.net/attachments/623891487683510323/1040610500276400178/image.png?width=581&height=676">
<br><br>
<b>Pipe Length (older version)</b>
<img src="https://media.discordapp.net/attachments/623891487683510323/1040454107493826650/image.png">
<br><br>
<b>Conveyor Belt Length & Relative Pos #1 (older version without angle)</b>
<img src="https://media.discordapp.net/attachments/623891487683510323/1040633819750998026/image.png?width=1440&height=618">
<br><br>
<b>Conveyor Belt Length & Relative Pos #2 (older version without angle)</b>
<img src="https://media.discordapp.net/attachments/623891487683510323/1040632972992323634/image.png?width=1373&height=676">
<br><br>
<b>Conveyor Belt Length & Relative Pos #3 (older version without angle)</b>
<img src="https://media.discordapp.net/attachments/623891487683510323/1040634469125730395/image.png?width=713&height=676">
</div><br><br>
<p>Known issues:</p>
<ul>
<li>The Move Buildable feature does work far from perfectly</li>
<li>Pipe and conveyor pole supports&rsquo; height display improperly</li>
</ul>
<p>A mod by SifVerT - Difficulty Tuner &amp; Factory Statistics
If you have any feedback you can find me on Discord as <strong>SifVerT</strong>. I&rsquo;m only on <strong>my own</strong> support server for support matters, should you require any help:</p>
<p><a href="https://discord.gg/Sdwpp7WAVD%22"><img loading="lazy" src="https://i.imgur.com/gjhaHhf.png" alt="DT Discord Server"  />
</a></p>
<p>Totally voluntary, but if you appreciate my work you may leave a little tip.</p>

<form action="https://www.paypal.com/donate" method="post" target="_top">
<input type="hidden" name="hosted_button_id" value="2G9J8Y8HLTTVG" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_SE/i/scr/pixel.gif" width="1" height="1" />
</form>

Icon by <a href="https://www.flaticon.com/free-icons/ruler" title="ruler icons">Ruler icons created by srip - Flaticon</a>
</details>
<li style="list-style: inside disclosure-closed;">
    <a class="deco-none" href="https://visualmod.gitee.io/satisfactory-mod/home/modlist">返回模组列表</a>
</li>
<li style="list-style: inside disclosure-closed;">
    <a class="deco-none" href="https://ficsit.app/mod/BuildGunUtilities" target="_blank">在 <u>ficsit.app</u> 中查看</a>
</li>



  </div>

  <footer class="post-footer">
    <ul class="post-tags">
    </ul>
  </footer>
</article>
    </main>
    
<footer class="footer">
    <span>&copy; 2023 <a href="https://visualmod.gitee.io/satisfactory-mod">幸福工厂模组</a></span>
    <span>
        Powered by
        <a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a> &
        <a href="https://github.com/adityatelange/hugo-PaperMod/" rel="noopener" target="_blank">PaperMod</a>
    </span>
</footer>
<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor">
        <path d="M12 6H0l6-6z" />
    </svg>
</a>

<script>
    let menu = document.getElementById('menu')
    if (menu) {
        menu.scrollLeft = localStorage.getItem("menu-scroll-position");
        menu.onscroll = function () {
            localStorage.setItem("menu-scroll-position", menu.scrollLeft);
        }
    }

    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener("click", function (e) {
            e.preventDefault();
            var id = this.getAttribute("href").substr(1);
            if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
                document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
                    behavior: "smooth"
                });
            } else {
                document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView();
            }
            if (id === "top") {
                history.replaceState(null, null, " ");
            } else {
                history.pushState(null, null, `#${id}`);
            }
        });
    });

</script>
<script>
    var mybutton = document.getElementById("top-link");
    window.onscroll = function () {
        if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
            mybutton.style.visibility = "visible";
            mybutton.style.opacity = "1";
        } else {
            mybutton.style.visibility = "hidden";
            mybutton.style.opacity = "0";
        }
    };

</script>
<script>
    document.getElementById("theme-toggle").addEventListener("click", () => {
        if (document.body.className.includes("dark")) {
            document.body.classList.remove('dark');
            localStorage.setItem("pref-theme", 'light');
        } else {
            document.body.classList.add('dark');
            localStorage.setItem("pref-theme", 'dark');
        }
    })

</script>
<script>
    document.querySelectorAll('pre > code').forEach((codeblock) => {
        const container = codeblock.parentNode.parentNode;

        const copybutton = document.createElement('button');
        copybutton.classList.add('copy-code');
        copybutton.innerHTML = '复制';

        function copyingDone() {
            copybutton.innerHTML = '已复制！';
            setTimeout(() => {
                copybutton.innerHTML = '复制';
            }, 2000);
        }

        copybutton.addEventListener('click', (cb) => {
            if ('clipboard' in navigator) {
                navigator.clipboard.writeText(codeblock.textContent);
                copyingDone();
                return;
            }

            const range = document.createRange();
            range.selectNodeContents(codeblock);
            const selection = window.getSelection();
            selection.removeAllRanges();
            selection.addRange(range);
            try {
                document.execCommand('copy');
                copyingDone();
            } catch (e) { };
            selection.removeRange(range);
        });

        if (container.classList.contains("highlight")) {
            container.appendChild(copybutton);
        } else if (container.parentNode.firstChild == container) {
            
        } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") {
            
            codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton);
        } else {
            
            codeblock.parentNode.appendChild(copybutton);
        }
    });
</script>
</body>

</html>
